package {{package}}.model;

{% for col_type in func.types(table['columns']) -%}
{% if not type[col_type].startswith('java.lang') -%}
import {{ type[col_type] }};
{% endif %}
{%- endfor %}
import {{package}}.entity.extend.{{table['camel']}}Extend;
import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * {{table['name']}} model
 * @author {{author}}
 * @date {{systime}}
 * @version V1.0
 */
@Entity
@Table(name = "{{table['name']}}")
public class {{table['camel']}} extends {{table['camel']}}Extend {

    {% for column in table['columns'] %}
    {% if column['comment'] != '' -%}
    {{"/** " + column['comment'] + "*/"}}
    {%- endif %}
    {% if column['index'] == 'primary' -%}
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    {% endif %}
    {% if type[column['type']] == 'java.util.Date' -%}
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    {%- endif %}
    private {{ type[column['type']].split('.')[2] }} {{ column['name'] }};
    {% endfor %}

    {% for column in table['columns'] %}
    public void set{{column['camel']}} ({{ type[column['type']].split('.')[2] }} {{ column['name'] }}){
        this.{{ column['name'] }} = {{ column['name'] }};
    }

    public {{ type[column['type']].split('.')[2] }} get{{column['camel']}}(){
        return this.{{ column['name'] }};
    }
    {% endfor %}
}